module(
    name = "rules_gleam",
    version = "0.1.14",
)

bazel_dep(name = "rules_go", version = "0.57.0")
bazel_dep(name = "gazelle", version = "0.45.0")
bazel_dep(name = "bazel_skylib", version = "1.8.1")
bazel_dep(name = "rules_erlang", version = "3.16.0")
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "bazel_features", version = "1.35.0")

# Download a suitable Go SDK.
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(version = "1.25.1")
use_repo(go_sdk, "go_host_compatible_sdk_label")

go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(
    fail_on_version_conflict = False,
    go_mod = "//:go.mod",
)
use_repo(go_deps, "com_github_bazelbuild_buildtools", "com_github_bmatcuk_doublestar_v4", "com_github_burntsushi_toml", "com_github_google_go_cmp", "com_github_kr_pretty", "com_github_kr_text", "com_github_lithammer_dedent", "com_github_pmezard_go_difflib", "com_github_rogpeppe_go_internal", "org_golang_x_mod", "org_golang_x_sync", "org_golang_x_sys", "org_golang_x_tools_go_vcs")

gleam = use_extension("//:extensions.bzl", "gleam")
gleam.deps(gleam_toml = "//:gleam/gleeunit/gleam.toml")
gleam.erlang(version = "latest")

# Registers the default toolchain to be the latest
# User of rules_gleam, can customize the default tool chains using the same extension tag:
gleam.toolchain(version = "latest")

register_toolchains("@gleam_toolchains//:all")
register_toolchains("@gleam_erlang_toolchains//:all")

use_repo(gleam, "gleam_compiler_aarch64_apple_darwin", "gleam_compiler_aarch64_pc_windows_msvc", "gleam_compiler_aarch64_unknown_linux_musl", "gleam_compiler_x86_64_apple_darwin", "gleam_compiler_x86_64_pc_windows_msvc", "gleam_compiler_x86_64_unknown_linux_musl", "gleam_erlang_toolchains", "gleam_hex_repositories_config", "gleam_toolchains", "hex_gleam_stdlib")

# Internal tools
gleam_tools = use_extension("//internal/tools:extensions.bzl", "tools")
use_repo(gleam_tools, "rules_gleam_go_repository_cache", "rules_gleam_internal_tools")
